<?PHP



// -------------------------------------------------------------------------------------------------------
function ShowInsertHyperlinkDialog ($objname, $window) {

        echo "<html style='width:425px; Height: 125px;'>";
        echo "<head>";
        echo "<title>"._HYPERTITLE."</title>";

        echo "<style> html, body, button, div, input, select, fieldset { font-family: MS Shell Dlg; font-size: 8pt; position: absolute; }; </style>";
        echo "<script language='javascript'>\n";

        echo "document.title = \""._HYPERTITLE."\";\n";

        echo "var highlightedText = window.dialogArguments;\n";
        echo "var target = \"\";\n";

        echo "function returnSelected() {\n";
        echo "        var text = escape( \"<a href='\" );\n";
        echo "        text     = text + escape( document.set.text.value );\n";
        echo "        if (target != \"\") {\n";
        echo "                text = text + escape( \"' target='\" );\n";
        echo "                text = text + escape( target );\n";
        echo "        }\n";
        echo "        text = text + escape( \"'>\" );\n";
        echo "        text = text + escape( document.set.desc.value );\n";
        echo "        text = text + escape( \"</a>\" );\n";
        echo "        window.returnValue = text;\n";          // set return value
        echo "        window.close();\n";                     // close dialog
        echo "}\n";

        // Now, if a person changes the protocol AFTER having entered the
        // link, the inputted link info isn't erased.
        echo "function myChange() {\n";
        echo "        var selectedItem              = document.set.type.selectedIndex;\n";
        echo "        var selectedItemValue         = document.set.type.options[selectedItem].value;\n";
        echo "        var selectedItemText          = document.set.type.options[selectedItem].text;\n";
        echo "        var inputtedText                = document.set.text.value;\n";
        echo "        var protocol                        = document.set.text.value.split(\":\");\n";
        echo "        if (protocol[1]) {\n";
        echo "                var datum = protocol[1].replace(/^\/\//, \"\");\n";
        echo "        } else {\n";
        echo "                var datum = protocol[0];\n";
        echo "        }\n";
        echo "        document.set.text.value = selectedItemValue + datum;\n";
        echo "}\n";

        echo "function updateTarget() {\n";
        echo "        var selectedItem                = document.set.target.selectedIndex;\n";
        echo "        var selectedItemValue        = document.set.target.options[selectedItem].value;\n";
        echo "        target = selectedItemValue;\n";
        echo "}\n";

        echo "function paste_link() {\n";
        echo "        document.set.desc.value = highlightedText;\n";
        echo "}\n";
        echo "</script>";

        echo "</head>";
        echo "<body style='background: threedface; color: windowtext; margin: 10px; BORDER-STYLE: none' onload='javascript: paste_link();' scroll=no>";
        echo "<form method=post name=set>";

        echo "<fieldset id=fldLayout style='left: 0.50em; top: 0.5em; width: 31.5em; height: 8.2000em;'></fieldset>";
        // titre type de lien
        echo "<div id=divFileName style='left: 1.50em; top: 1.5em; width: 5.0em; height: 1.2168em;'>"._HYPERTYPE."</div>";
        echo "<div id=divFileName style='left: 7.00em; top: 1.4em; width: 7.0em; height: 1.2168em;'>";
        echo "<select name=type onchange='javascript: myChange();'>";
        echo "<option value=\"\">"._HYPERTYPE01;
        echo "<option value=\"file://\">"._HYPERTYPE02;
        echo "<option value=\"ftp://\">"._HYPERTYPE03;
        echo "<option value=\"gopher:\">"._HYPERTYPE04;
        echo "<option value=\"http://\" selected>"._HYPERTYPE05;
        echo "<option value=\"https://\">"._HYPERTYPE06;
        echo "<option value=\"mailto:\">"._HYPERTYPE07;
        echo "<option value=\"news:\">"._HYPERTYPE08;
        echo "<option value=\"telnet:\">"._HYPERTYPE09;
        echo "<option value=\"wias:\">"._HYPERTYPE10;
        echo "</select>";
        echo "</div>";

        // titre destination de lien
        echo "<div id=divFileName style='left: 17.50em; top: 1.5em; width: 5.0em; height: 1.2168em;'>"._HYPERDEST."</div>";
        echo "<div id=divFileName style='left: 25.00em; top: 1.4em; width: 7.0em; height: 1.2168em;'>";
        echo "<select name=target onChange='javascript: updateTarget();'>";
        echo "<option value=\"\">";
        echo "<option value=\"_blank\">_blank";
        echo "<option value=\"_parent\">_parent";
        echo "<option value=\"_self\">_self";
        echo "<option value=\"_top\">_top";
        echo "</select>";
        echo "</div>";

        // titre lien
        echo "<div id=divFileName style='left: 1.50em; top: 4.0em; width: 5em; height: 1.2168em;'>"._HYPERURL."</div>";
        echo "<input style='left: 7.00em; top: 3.6em; width: 23.80em; height: 2.0000em;' name=text type=text value=\"http://\" size=30>";

        // titre texte
        echo "<div id=divFileName style='left: 1.50em; top: 6.1em; width: 5em; height: 1.2168em;'>"._HYPERTEXT."</div>";
        echo "<input style='left: 7.00em; top: 5.8em; width: 23.80em; height: 2.0000em;' name=desc type=text value=\"\" size=30>";

        // Boutons
        echo "<input style='left: 32.50em; top: 0.5em; width: 6em; height: 2.2000em;' value="._BTNENTER."  type=button onClick='returnSelected()'>";
        echo "<input style='left: 32.50em; top: 3.0em; width: 6em; height: 2.2000em;' value="._BTNCANCEL." type=button onClick='window.close()'>";

        echo "</form>";
        echo "</body>";
        echo "</html>";
}

?>
